package vip.xiaonuo.bi.modular.dataset.controller;

import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import vip.xiaonuo.bi.modular.datasource.service.DataColumnsService;
import vip.xiaonuo.common.pojo.CommonResult;

/**
 * @auther: 顾育司
 * @Description
 * @date: 2024/1/30
 */
@Api(tags = "数据集-字段管理")
@ApiSupport(author = "SNOWY_TEAM", order = 1)
@RestController
@Validated
public class DatasetColumnsController {

    @Autowired
    DataColumnsService dataColumnsService;
    @ApiOperation("数据集-更新列名或增加计算字段")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id",required = true, value = "字段的id"),
            @ApiImplicitParam(name = "alias",required = false, value = "字段名称(别名)"),
            @ApiImplicitParam(name = "calculate", required = false, value = "计算公式"),
    })
    @PostMapping("/bi/datasetCol/updateByid")
    public CommonResult getColInfo (Long id,String alias,String calculate) {
        dataColumnsService.updateByColId(id,alias,calculate);
        return  CommonResult.ok();
    }
}
